#ifndef GRAPHDATA_H
#define GRAPHDATA_H

#include <qcustomplot.h>

namespace Graph
{

typedef struct
{
    QColor color;
    bool visible;
} GraphSettings;

class GraphData : public QObject
{
    Q_OBJECT
public:
    GraphData(QCPGraph * graph, QListWidgetItem * item, const int &coloumn, QVector<double> *time, const GraphSettings &graphSettings);
    ~GraphData();

    QCPGraph *GetGraph();

    void RefreshData();
    void PushBack(const double &value);
    const QVector<double> &GetValue() const;

    void ChangeOffSet(const double &value);

    bool IsVisible() const;

    void ClearOffSet();
    void Clear();
    void ClearAll();

    void SetColor(const QColor &color);
    const QColor GetColor() const;

    int GetColoumnFile();
    void SetColoumnFile(int value);

    double getMax() const;
    double getMin() const;

signals:
    void GraphIsVisible(const QString &name);

public slots:
    void itemChanged(QListWidgetItem * item);

protected:
    QCPGraph * graph;
    QVector<double> value;

    QVector<double> * time;
    double offset = 0.0;

    int coloumnFile = 0;

    double max;
    double min;

    QListWidgetItem * widgetItem;
};

}



#endif // GRAPHDATA_H
